﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BLL.wlBLL
{
    public class BllComboList
    {
        /// <summary>
        /// 文章类型
        /// </summary>
        /// <returns></returns>
        public static DataTable GetArticleCategory()
        {
            WLong.BLL .OtherCategory other = new WLong.BLL.OtherCategory ();

            DataTable dt = other.GetList("Disabled = 0").Tables[0];

            return dt;
        }

        /// <summary>
        /// 权限类型
        /// </summary>
        /// <returns></returns>
        public static DataTable GetPurview()
        {
            WLong.BLL.Purview purview = new WLong.BLL.Purview();
            DataTable dt = purview.GetList("Disabled = 0").Tables[0];
            return dt;
        }

        /// <summary>
        /// 返回等级
        /// </summary>
        /// <returns></returns>
        public static DataTable GetGrade()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("LName");
            dt.Columns.Add("LValue");
            DataRow dr = dt.NewRow();
            dr["LName"] = "一级";
            dr["LValue"] = 0;
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["LName"] = "二级";
            dr["LValue"] = 1;
            dt.Rows.Add(dr);

            return dt;
        }

        /// <summary>
        /// 上一级
        /// </summary>
        /// <param name="grade"></param>
        /// <returns></returns>
        public static DataTable GetPriorId(int grade)
        {
            int temp = 0;
            if (grade == 0)
            {
                temp = 0;
            }
            else
            {
                temp = grade - 1;
            }
            WLong.BLL.Category category = new WLong.BLL.Category();
            DataTable dt = category.GetList("Disabled=0 and Grade ='" + temp + "'").Tables[0];
            return dt;
        }

        /// <summary>
        /// 最高级
        /// </summary>
        /// <param name="grade"></param>
        /// <returns></returns>
        public static DataTable GetHighId()
        {
            WLong.BLL.Category category = new WLong.BLL.Category();
            DataTable dt = category.GetList("Disabled=0 and Grade ='" + 0 + "'").Tables[0];
            return dt;
        }
    }
}
